package com.evry.sandox.batch;

import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.validation.BindException;

import com.evry.sandox.batch.domain.CollateralItem;


public class CustomFieldSetMapper implements FieldSetMapper<CollateralItem> {
	
	public static final String ID = "ID";
	public static final String TYPE = "TYPE";
	public static final String NAME = "NAME";

	public CollateralItem mapFieldSet(FieldSet fieldSet) throws BindException {
		CollateralItem item = new CollateralItem();
		item.setId(fieldSet.readBigDecimal(ID));
		item.setType(fieldSet.readString(TYPE));
		item.setName(fieldSet.readString(NAME));
		return item;
	}
	
}
